<?php

namespace app\api\controller;

use app\common\controller\Api;
use think\Cache;
use think\helper\Arr;
use think\Exception;

use app\common\services\DocService;

/**
 * 资料中心
 */
class Doc extends Api
{

    protected $noNeedRight = '*';
  
    public function list(){

        $data['status'] = 1;
        
        $page_info = $this->getPerPage();
        $cache_key = 'doc_lists:'.md5(serialize($data).serialize($page_info));
        $cache  = Cache::get($cache_key);
        if($cache && $this->__flush_cache === false){
            return $this->success('success',$cache);
        }

        $result =  DocService::list($data, $page_info);
        Cache::set($cache_key, $result, $this->getTtl());
        return $this->success('success',$result);
    }

}
